<?php

namespace App\Eloquent;

class FriendlyLink extends Model
{
    /**
     * codetype 友情链接类型
     */
    const FRIENDLY_LINK_TYPE = 'friendly_link_type';
    protected $fillable = ['name', 'link', 'link_type', 'image', 'description', 'sort'];

    public static function get_types()
    {
        return Code::getByTypeId(self::FRIENDLY_LINK_TYPE);
    }
    /*
     * 查询友情链接
     */
    public static function getFriendlyLink($cate,$id){
        $friendly_links=FriendlyLink::where('link_type','=',$cate)
            ->orderBy('sort','asc')
            ->limit($id)
            ->get();
        return $friendly_links;
    }
}